#ifndef LOGINDIALOG_H
#define LOGINDIALOG_H

#include <QDialog>
//#include <QtSerialPort/QSerialPort>

#include <QNetworkRequest>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#include <QUrl>
#include <QLineEdit>
#include <QKeyEvent>
#include <QWidget>
#include <settingsdialog.h>
#include <colordialog.h>
#include <mainwindow.h>
#include <updatethread.h>

QT_USE_NAMESPACE

QT_BEGIN_NAMESPACE

namespace Ui {
class LoginDialog;
}
class QIntValidator;

QT_END_NAMESPACE

class LoginDialog : public QDialog
{
    Q_OBJECT

public:
    explicit LoginDialog(QWidget *parent = 0);
    ~LoginDialog();
    void keyPressEvent(QKeyEvent *event);
    void initialConfig();
    bool readConfig();
private slots:
    void login();
    bool eventFilter(QObject *,QEvent *);
    void serviceRequestFinished(QNetworkReply *reply);
    void handlelineeditclicked();
    void updateApp();

private:
    SettingsDialog *settingDialog = new SettingsDialog;
    ColorDialog *colorDialog = new ColorDialog;
    MainWindow *mainWindow = new MainWindow;
    Ui::LoginDialog *ui;
    QUrl url;
    QNetworkRequest httpRequest;
    QNetworkAccessManager networkAccessManager;
    QLineEdit *wachedLineEdit;
    UpdateThread *upThread;
    bool isRead;
    DebugLog *log;
    QString baseUrl;
    QString sysVersion;
    QString uptime;
    QString sysServer;
    QString sysPort;
};
#endif // LOGINDIALOG_H
